1 Vehicle counts

1.1 Original data

Detailed example counts for week of 2018-12-03 across type and direction.

Overview of months, inbound

1.2 Stocks on campus

1.2.1 Without modification

1.2.2 With midnight ‘reset’

Frequency of net from whole period

Frequency of stocks from whole period

2 Wi-Fi

2.1 Original data

Detailed example counts for week of 2018-12-09 across type of data.

Overview of months, connected users

2.2 Distribution of counts

Frequency of counts from whole period

2.3 Distribution fits

3 Time series comparisons

3.1 Inbound, connected users

3.2 Outbound, connected users

3.3 Net, connected users

3.4 Stocks, connected users

4 Correlations, connected users

5 Models

5.1 INLA setup

# ####
# Jeffreys prior 
a1 <- 5e-5
b1 <- 5e-5
lgprior1 <- list(prec = list(param = c(a1, b1)))

# Gelman prior
a2 <- -0.5
b2 <- 5e-5
lgprior2 <- list(prec = list(param = c(a2, b2)))

# iid prior 
# Schrödle & Held 2010 & Blangiardo et al 2013
a0 <- 1
b0 <- 0.1
prior.nu <- list(prec = list(param = c(a0, b0)))

# intercept & fixed
inla.set.control.fixed.default() 

# intercept ~ N(0,0) 
# other fixed effects ~ N(0, 0.001) 
# 
# where the format is N(mean, precision) 
# precision = inverse of the variance. 

# PC prior
U <- 1
hyper.prec = list(theta = list(
  prior = "pc.prec",
  param = c(U, 0.01)
))

# scaling 
inla.setOption(scale.model.default = TRUE)

5.2 RW1

5.3 One trend for stocks

mod1 <- inla(users_mac ~ 
               f(stock, model = "rw1", scale.model = TRUE, hyper = hyper.prec), 
             family = "nbinomial", 
             control.compute = list(dic= TRUE, waic = TRUE),  
             data = data)

Call:
   c("inla.core(formula = formula, family = family, contrasts = contrasts, 
   ", " data = data, quantiles = quantiles, E = E, offset = offset, ", " 
   scale = scale, weights = weights, Ntrials = Ntrials, strata = strata, 
   ", " lp.scale = lp.scale, link.covariates = link.covariates, verbose = 
   verbose, ", " lincomb = lincomb, selection = selection, control.compute 
   = control.compute, ", " control.predictor = control.predictor, 
   control.family = control.family, ", " control.inla = control.inla, 
   control.fixed = control.fixed, ", " control.mode = control.mode, 
   control.expert = control.expert, ", " control.hazard = control.hazard, 
   control.lincomb = control.lincomb, ", " control.update = 
   control.update, control.lp.scale = control.lp.scale, ", " 
   control.pardiso = control.pardiso, only.hyperparam = only.hyperparam, 
   ", " inla.call = inla.call, inla.arg = inla.arg, num.threads = 
   num.threads, ", " blas.num.threads = blas.num.threads, keep = keep, 
   working.directory = working.directory, ", " silent = silent, inla.mode 
   = inla.mode, safe = FALSE, debug = debug, ", " .parent.frame = 
   .parent.frame)") 
Time used:
    Pre = 0.704, Running = 4.94, Post = 0.535, Total = 6.18 
Fixed effects:
             mean    sd 0.025quant 0.5quant 0.975quant  mode kld
(Intercept) 7.416 0.006      7.404    7.416      7.427 7.416   0

Random effects:
  Name    Model
    stock RW1 model

Model hyperparameters:
                                                       mean    sd 0.025quant
size for the nbinomial observations (1/overdispersion) 6.93 0.136       6.67
Precision for stock                                    3.36 0.708       2.19
                                                       0.5quant 0.975quant mode
size for the nbinomial observations (1/overdispersion)     6.93       7.20 6.93
Precision for stock                                        3.28       4.96 3.12

Deviance Information Criterion (DIC) ...............: 79444.34
Deviance Information Criterion (DIC, saturated) ....: 153614.32
Effective number of parameters .....................: 121.68

Watanabe-Akaike information criterion (WAIC) ...: 79467.01
Effective number of parameters .................: 138.42

Marginal log-Likelihood:  -47532.98 
 is computed 
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')

5.4 One trend for stocks + weekday

mod2 <- inla(users_mac ~ 
               weekday +
               f(stock, model = "rw1", scale.model = TRUE, hyper = hyper.prec), 
             family = "nbinomial", 
             control.compute = list(dic= TRUE, waic = TRUE),  
             data = data)

Call:
   c("inla.core(formula = formula, family = family, contrasts = contrasts, 
   ", " data = data, quantiles = quantiles, E = E, offset = offset, ", " 
   scale = scale, weights = weights, Ntrials = Ntrials, strata = strata, 
   ", " lp.scale = lp.scale, link.covariates = link.covariates, verbose = 
   verbose, ", " lincomb = lincomb, selection = selection, control.compute 
   = control.compute, ", " control.predictor = control.predictor, 
   control.family = control.family, ", " control.inla = control.inla, 
   control.fixed = control.fixed, ", " control.mode = control.mode, 
   control.expert = control.expert, ", " control.hazard = control.hazard, 
   control.lincomb = control.lincomb, ", " control.update = 
   control.update, control.lp.scale = control.lp.scale, ", " 
   control.pardiso = control.pardiso, only.hyperparam = only.hyperparam, 
   ", " inla.call = inla.call, inla.arg = inla.arg, num.threads = 
   num.threads, ", " blas.num.threads = blas.num.threads, keep = keep, 
   working.directory = working.directory, ", " silent = silent, inla.mode 
   = inla.mode, safe = FALSE, debug = debug, ", " .parent.frame = 
   .parent.frame)") 
Time used:
    Pre = 0.603, Running = 6.01, Post = 0.503, Total = 7.12 
Fixed effects:
                   mean    sd 0.025quant 0.5quant 0.975quant   mode kld
(Intercept)       7.373 0.014      7.345    7.373      7.400  7.373   0
weekdayMonday     0.030 0.020     -0.008    0.030      0.069  0.030   0
weekdaySaturday   0.000 0.021     -0.041    0.000      0.041  0.000   0
weekdaySunday     0.026 0.021     -0.016    0.026      0.068  0.026   0
weekdayThursday   0.232 0.020      0.194    0.232      0.271  0.232   0
weekdayTuesday   -0.041 0.020     -0.079   -0.041     -0.002 -0.041   0
weekdayWednesday  0.030 0.020     -0.009    0.030      0.068  0.030   0

Random effects:
  Name    Model
    stock RW1 model

Model hyperparameters:
                                                       mean    sd 0.025quant
size for the nbinomial observations (1/overdispersion) 7.22 0.140       6.94
Precision for stock                                    3.95 0.788       2.63
                                                       0.5quant 0.975quant mode
size for the nbinomial observations (1/overdispersion)     7.21       7.50 7.21
Precision for stock                                        3.87       5.71 3.72

Deviance Information Criterion (DIC) ...............: 79219.74
Deviance Information Criterion (DIC, saturated) ....: 153389.73
Effective number of parameters .....................: 120.52

Watanabe-Akaike information criterion (WAIC) ...: 79230.99
Effective number of parameters .................: 127.12

Marginal log-Likelihood:  -47456.16 
 is computed 
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')

5.5 One trend for stocks + weekend + weekday

mod3 <- inla(users_mac ~ 
               weekend +
               weekday +
               f(stock, model = "rw1", scale.model = TRUE, hyper = hyper.prec), 
             family = "nbinomial", 
             control.compute = list(dic= TRUE, waic = TRUE),  
             data = data)

Call:
   c("inla.core(formula = formula, family = family, contrasts = contrasts, 
   ", " data = data, quantiles = quantiles, E = E, offset = offset, ", " 
   scale = scale, weights = weights, Ntrials = Ntrials, strata = strata, 
   ", " lp.scale = lp.scale, link.covariates = link.covariates, verbose = 
   verbose, ", " lincomb = lincomb, selection = selection, control.compute 
   = control.compute, ", " control.predictor = control.predictor, 
   control.family = control.family, ", " control.inla = control.inla, 
   control.fixed = control.fixed, ", " control.mode = control.mode, 
   control.expert = control.expert, ", " control.hazard = control.hazard, 
   control.lincomb = control.lincomb, ", " control.update = 
   control.update, control.lp.scale = control.lp.scale, ", " 
   control.pardiso = control.pardiso, only.hyperparam = only.hyperparam, 
   ", " inla.call = inla.call, inla.arg = inla.arg, num.threads = 
   num.threads, ", " blas.num.threads = blas.num.threads, keep = keep, 
   working.directory = working.directory, ", " silent = silent, inla.mode 
   = inla.mode, safe = FALSE, debug = debug, ", " .parent.frame = 
   .parent.frame)") 
Time used:
    Pre = 0.5, Running = 6.45, Post = 0.288, Total = 7.24 
Fixed effects:
                   mean     sd 0.025quant 0.5quant 0.975quant   mode kld
(Intercept)       7.373  0.014      7.345    7.373      7.400  7.373   0
weekendWeekend    0.009 18.257    -35.837    0.008     35.824  0.009   0
weekdayMonday     0.030  0.020     -0.008    0.030      0.069  0.030   0
weekdaySaturday  -0.009 18.257    -35.854   -0.009     35.807 -0.009   0
weekdaySunday     0.017 18.257    -35.828    0.017     35.833  0.017   0
weekdayThursday   0.232  0.020      0.194    0.232      0.271  0.232   0
weekdayTuesday   -0.041  0.020     -0.079   -0.041     -0.002 -0.041   0
weekdayWednesday  0.030  0.020     -0.009    0.030      0.068  0.030   0

Random effects:
  Name    Model
    stock RW1 model

Model hyperparameters:
                                                       mean    sd 0.025quant
size for the nbinomial observations (1/overdispersion) 7.22 0.141       6.94
Precision for stock                                    3.93 0.797       2.63
                                                       0.5quant 0.975quant mode
size for the nbinomial observations (1/overdispersion)     7.22       7.50 7.21
Precision for stock                                        3.84       5.76 3.65

Deviance Information Criterion (DIC) ...............: 79219.89
Deviance Information Criterion (DIC, saturated) ....: 153389.87
Effective number of parameters .....................: 120.60

Watanabe-Akaike information criterion (WAIC) ...: 79230.98
Effective number of parameters .................: 127.05

Marginal log-Likelihood:  -47456.69 
 is computed 
Posterior summaries for the linear predictor and the fitted values are computed
(Posterior marginals needs also 'control.compute=list(return.marginals.predictor=TRUE)')

5.6 Comparing

5.6.1 DIC

5.6.2 WAIC